/**
 *
 */

#ifndef __HEADER_CONFIG
#define __HEADER_CONFIG

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <pthread.h>
#include <netdb.h>
#include<string.h>


#define USERS 4 
#define MAXBUFFLEN 1024			//Max size of message being received by any node

/*
Types of messages being sent.
First three messagetypes are used for clock synchronization
*/
#define SEND_SYNC1 1			//Time stamp sent for synchronization
#define RECV_SYNC1 2			//Acknowledge message and time stamps sent
#define LEARN_SYNC 3			//Time for synchronizing learnt

//Type 4 is for Multicast
#define MT_MULTICAST 4

//Types 5-7 are to are used for Leader Election
#define MT_ELECTN_INIT 5		//Message for election
#define MT_ANSWERMSG 6			//Acknowledge message sent by the listening node
#define MT_COORD 7			//Coordination message sent by leader chosen

//Type 9 is for logging messages of synchronization
#define MT_LOGMSG 9

extern char ipclass[];
extern char ipclass_w[];
extern char node[][4];

extern int sockfd;							//Denotes the socket being used for send and receive
extern int hno;								//Denotes the index corresponding to your own node

extern struct sockaddr_in addr[];
extern char add[][16];

//Function to check which IP is the host IP
int server_check(char *);

//Function to initialize addresses of IPs
void add_init(int);

struct sockaddr_in get_my_addr();

#endif //__HEADER_CONFIG

